home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-10-25 | 11.4 KB | 387 lines | [TEXT/MPS ] |
- /* Copyright © 1986-1990 Apple Computer, Inc. All rights reserved. */
-
- /* • Auto-Include the requirements for this source */
- #ifndef __TYPES.R__
- #include "Types.r"
- #endif
-
- #ifndef __MacAppTypes__
- #include "MacAppTypes.r"
- #endif
-
- #if qTemplateViews
- #ifndef __ViewTypes__
- #include "ViewTypes.r"
- #endif
- #endif
-
- #if qDebug
- include "Debug.rsrc";
- #endif
- include "MacApp.rsrc";
- include "Printing.rsrc";
-
- include $$Shell("ObjApp")"DrawShapes" 'CODE';
-
- /* Resource ids */
- #define kShapeWindowRSRCID 1005 /* The main document window */
- #define kShapeViewRSRCID 1006 /* the shape view resource */
- #define kColorMenuBar 131 /* Menu bar for a color system */
- #define kNonColorMenuBar 132 /* Menu bar for a black & white system */
- #define kRainbowArrow 140
- #define kPickerPrompt 256 /* 'STR ' resource for Color Picker */
- #define mGoodies 4 /* the goodies menu */
- #define mColor 6 /* The Color menu resource id */
- #define mMoreDebug 7 /* Menu number for the 'More Debug' menu */
-
- /* Command numbers */
- #define cWhite 1000 /* The five shades in the 'Shades' menu */
- #define cLtGray 1001
- #define cGray 1002
- #define cDkGray 1003
- #define cBlack 1004
- #define cPickColor 1005 /* Command to bring up Color Picker */
-
- #define cNewShape 1010 /* Command to draw a new shape */
- #define cMoveShape 1011 /* Command to move one or more shapes */
- #define cChangeShade 1012 /* Buzz command for "Undo Shade Change" */
- #define cChangeColor 1013 /* Buzz command for "Undo Color Change" */
-
- #define cPasteReplacesSelection 118 /* Three commands in the 'More Debug' menu */
- #define cRecalcExtent 119
- #define cConstrainDrags 120
- #define cBetterFeedback 121
-
- /* view constants */
- #define kMaxCoord 30000 /* largest possible QuickDraw view coordinate
- (QuickDraw maximum minus slop for size of screen) */
- #define kPaletteWidth 41 /* Width of the palette */
-
- resource 'DITL' (phAboutApp, purgeable) {
- {
- /* [ 1] */ {160, 182, 180, 262},
- Button {
- enabled,
- "OK"
- };
- /* [ 2] */ {10, 75, 150, 320},
- StaticText {
- disabled,
- "This sample program demonstrates many features of MacApp.\n\n"
- "This program was written with MacApp® © 1985-1990 Apple Computer, Inc."
- };
- /* [ 3] */ {10, 20, 42, 52},
- Icon {
- disabled,
- 1
- }
- }
- };
-
- include "Defaults.rsrc" 'ALRT' (phAboutApp); // Grab the default about box
-
- #if qTemplateViews
-
- // This guy is used with template views (this is the recommended approach)
- resource 'view' (kShapeWindowRSRCID, purgeable) { {
- root, 'WIND', { 50, 40 }, { 200, 396 }, sizeVariable, sizeVariable, shown, enabled,
- Window {
- "",
- zoomDocProc, goAwayBox, resizable, modeless, ignoreFirstClick, freeOnClosing,
- disposeOnFree, closesDocument, openWithDocument, dontAdaptToScreen, stagger,
- forceOnScreen, dontCenter, 'SHAP', "<<<>>>" };
-
- 'WIND', 'PLTT', { 0, 0 }, { 0, kPaletteWidth }, sizeSuperView, sizeFixed, shown, enabled,
- view { "TPalette" };
-
- 'WIND', 'SCLR', { 0, kPaletteWidth }, { 200-kSBarSizeMinus1, 396-kSBarSizeMinus1-kPaletteWidth },
- sizeRelSuperView, sizeRelSuperView, shown, enabled,
- Scroller {
- "",
- vertScrollBar, horzScrollBar, 0, 0, 16, 16,
- noVertConstrain, noHorzConstrain, { 0, 0, 0, 0 } };
-
- 'SCLR', IncludeViewsAt { kShapeViewRSRCID, { 0, 0 } };
- } };
-
- resource 'view' (kShapeViewRSRCID, purgeable) { {
- root, 'SHAP', { 0, 0 }, { kMaxCoord, kMaxCoord }, sizeFillPages, sizeFillPages, shown, enabled,
- view { "TShapeView" };
- } };
-
- #else
-
- // This guy is used when the template stuff isn't (but…template views are recommended, see above)
- resource 'WIND' (kShapeWindowRSRCID, purgeable) {
- {50, 40, 250, 436},
- zoomDocProc,
- invisible,
- goAway,
- 0x0,
- ""
- };
-
- #endif
-
- resource 'SIZE' (-1) {
- saveScreen,
- acceptSuspendResumeEvents,
- enableOptionSwitch,
- canBackground,
- MultiFinderAware,
- backgroundAndForeground,
- dontGetFrontClicks,
- ignoreChildDiedEvents,
- is32BitCompatible,
- reserved,
- reserved,
- reserved,
- reserved,
- reserved,
- reserved,
- reserved,
- #if qDebug
- 468 * 1024,
- 330 * 1024
- #else
- 230 * 1024,
- 160 * 1024
- #endif
- };
-
- /* Quitting and saving files is the most memory intensive part of this program.
- In addition to the resident segments, these segments are needed. */
-
- resource 'seg!' (256, purgeable) {
- {
- "GTerminate";
- "GWriteFile";
- "GClipboard";
- "GDoCommand";
- "GClose";
- "GNonRes";
- "GSelCommand";
- "GFile";
- }
- };
-
- resource 'STR ' (kPickerPrompt) {
- "Pick a color, any color…"
- };
-
- include "Defaults.rsrc" 'cmnu' (mApple); // Grab the default Apple/File menus
- include "Defaults.rsrc" 'cmnu' (mFile);
-
- resource 'cmnu' (mEdit) {
- mEdit,
- textMenuProc,
- 0x7FFFFF7D,
- enabled,
- "Edit",
- { /* array: 9 elements */
- /* [1] */ "Undo", noIcon, "Z", noMark, plain, cUndo;
- /* [2] */ "-", noIcon, noKey, noMark, plain, nocommand;
- /* [3] */ "Cut", noIcon, "X", noMark, plain, cCut;
- /* [4] */ "Copy", noIcon, "C", noMark, plain, cCopy;
- /* [5] */ "Paste", noIcon, "V", noMark, plain, cPaste;
- /* [6] */ "Clear", noIcon, noKey, noMark, plain, cClear;
- /* [7] */ "Select All", noIcon, "A", noMark, plain, cSelectAll;
- /* [8] */ "-", noIcon, noKey, noMark, plain, nocommand;
- /* [9] */ "Show Clipboard", noIcon, noKey, noMark, plain, cShowClipboard
- }
- };
-
- resource 'cmnu' (mGoodies) {
- mGoodies,
- textMenuProc,
- 0x7FFFFF37,
- enabled,
- "Goodies",
- {
- /* [1] */ "Show Page Breaks",
- noIcon, noKey, noMark, plain, cShowBreaks;
- /* [2] */ "-", noIcon, noKey, noMark, plain, nocommand;
- /* [3] */ "Better feedback desired",
- noIcon, noKey, noMark, plain, cBetterFeedback
- }
- };
-
- resource 'cmnu' (5) {
- 5,
- textMenuProc,
- allEnabled,
- enabled,
- "Shades",
- { /* array: 5 elements */
- /* [1] */ "White", noIcon, noKey, noMark, plain, cWhite;
- /* [2] */ "25% Shading", noIcon, noKey, noMark, plain, cLtGray;
- /* [3] */ "50% Shading", noIcon, noKey, noMark, plain, cGray;
- /* [4] */ "75% Shading", noIcon, noKey, noMark, plain, cDkGray;
- /* [5] */ "100% Shading", noIcon, noKey, noMark, plain, cBlack
- }
- };
-
- resource 'cmnu' (mColor) {
- mColor,
- textMenuProc,
- allEnabled,
- enabled,
- "Colors",
- { /* array: 9 elements */
- /* [1] */ "Green", noIcon, noKey, noMark, plain, noCommand;
- /* [2] */ "Yellow", noIcon, noKey, noMark, plain, noCommand;
- /* [3] */ "Orange", noIcon, noKey, noMark, plain, noCommand;
- /* [4] */ "Red", noIcon, noKey, noMark, plain, noCommand;
- /* [5] */ "Purple", noIcon, noKey, noMark, plain, noCommand;
- /* [6] */ "Blue", noIcon, noKey, noMark, plain, noCommand;
- /* [7] */ "Black", noIcon, noKey, noMark, plain, noCommand;
- /* [8] */ "-", noIcon, noKey, noMark, plain, noCommand;
- /* [9] */ "Pick a Color…", noIcon, noKey, noMark, plain, cPickColor
- }
- };
-
- resource 'cmnu' (mMoreDebug) {
- mMoreDebug,
- textMenuProc,
- allEnabled,
- enabled,
- "More Debug",
- { /* array: 3 elements */
- /* [1] */ "Paste Replaces Selection",
- noIcon, noKey, noMark, plain, cPasteReplacesSelection;
- /* [2] */ "Recompute view extent",
- noIcon, noKey, noMark, plain, cRecalcExtent;
- /* [3] */ "Constrain dragging to view borders",
- noIcon, noKey, noMark, plain, cConstrainDrags
- }
- };
-
- resource 'mctb' (mColor) {
- {
- /* Green */
- mColor, 1,
- {
- 0x0000, 0xDB00, 0x0000; /* Mark color */
- 0x0000, 0xDB00, 0x0000; /* Name color */
- 0x0000, 0xDB00, 0x0000; /* Command Key color */
- 0xFFFF, 0xFFFF, 0xFFFF /* Background color */
- };
- /* Yellow */
- mColor, 2,
- {
- 0xFFFF, 0xDB00, 0x0000; /* Mark color */
- 0xFFFF, 0xDB00, 0x0000; /* Name color */
- 0xFFFF, 0xDB00, 0x0000; /* Command Key color */
- 0xFFFF, 0xFFFF, 0xFFFF /* Background color */
- };
- /* Orange */
- mColor, 3,
- {
- 0xFFFF, 0x4700, 0x0000; /* Mark color */
- 0xFFFF, 0x4700, 0x0000; /* Name color */
- 0xFFFF, 0x4700, 0x0000; /* Command Key color */
- 0xFFFF, 0xFFFF, 0xFFFF /* Background color */
- };
- /* Red */
- mColor, 4,
- {
- 0xDB00, 0x0000, 0x0000; /* Mark color */
- 0xDB00, 0x0000, 0x0000; /* Name color */
- 0xDB00, 0x0000, 0x0000; /* Command Key color */
- 0xFFFF, 0xFFFF, 0xFFFF /* Background color */
- };
- /* Purple */
- mColor, 5,
- {
- 0x9200, 0x0000, 0xB000; /* Mark color */
- 0x9200, 0x0000, 0xB000; /* Name color */
- 0x9200, 0x0000, 0xB000; /* Command Key color */
- 0xFFFF, 0xFFFF, 0xFFFF /* Background color */
- };
- /* Blue */
- mColor, 6,
- {
- 0x0000, 0x0000, 0xFFFF; /* Mark color */
- 0x0000, 0x0000, 0xFFFF; /* Name color */
- 0x0000, 0x0000, 0xFFFF; /* Command Key color */
- 0xFFFF, 0xFFFF, 0xFFFF /* Background color */
- };
- /* Black */
- mColor, 7,
- {
- 0x0000, 0x0000, 0x0000; /* Mark color */
- 0x0000, 0x0000, 0x0000; /* Name color */
- 0x0000, 0x0000, 0x0000; /* Command Key color */
- 0xFFFF, 0xFFFF, 0xFFFF /* Background color */
- }
- }
- };
-
- resource 'cmnu' (mBuzzwords) {
- mBuzzwords,
- textMenuProc,
- allEnabled,
- enabled,
- "Buzzwords",
- { /* array: 5 elements */
- /* [1] */ "Drawing", noIcon, noKey, noMark, plain, cNewShape;
- /* [2] */ "Move", noIcon, noKey, noMark, plain, cMoveShape;
- /* [3] */ "Page Setup Change", noIcon, noKey, noMark, plain, cChangePrinterStyle;
- /* [4] */ "Shade Change", noIcon, noKey, noMark, plain, cChangeShade;
- /* [5] */ "Color Change", noIcon, noKey, noMark, plain, cChangeColor
- }
- };
-
- /* Menu bar for a color system */
- resource 'MBAR' (kColorMenuBar) {
- {mApple; mFile; mEdit; 5; mColor; mGoodies}
- };
-
- /* Menu bar for a non-color system */
- resource 'MBAR' (kNonColorMenuBar) {
- {mApple; mFile; mEdit; 5; mGoodies}
- };
-
- resource 'MBAR' (kMBarNotDisplayed) {
- {mMoreDebug}
- };
-
- /* The color "rainbow" arrow cursor */
- data 'crsr' (kRainbowArrow, "Rainbow Arrow") {
- $"8001 0000 0062 0000 0096 0000 0000 0000" /* Ä....b...ñ...... */
- $"0000 0000 0000 4000 6000 7000 7800 7C00" /* ......@.`.p.x.|. */
- $"7E00 7F00 7F80 7C00 6C00 4600 0600 0300" /* ~....Ä|.l.F..... */
- $"0100 0000 C000 E000 F000 F800 FC00 FE00" /* ....¿........... */
- $"FF00 FF80 FFC0 FFE0 FE00 EF00 CF00 8780" /* ...Ä.¿......œ.áÄ */
- $"0780 0380 0001 0001 0000 0000 0000 0000" /* .Ä.Ä............ */
- $"0000 0000 0000 8008 0000 0000 0010 0010" /* ......Ä......... */
- $"0000 0000 0000 0000 0048 0000 0048 0000" /* .........H...H.. */
- $"0000 0004 0000 0000 0000 0000 0000 0116" /* ................ */
- $"0000 0000 0000 0000 0000 0000 0000 0100" /* ................ */
- $"0000 0000 0000 0110 0000 0000 0000 0121" /* ...............! */
- $"0000 0000 0000 0222 2000 0000 0000 0233" /* ......." ......3 */
- $"3200 0000 0000 0333 3330 0000 0000 0344" /* 2......330.....D */
- $"4445 0000 0000 0444 4445 5000 0000 0444" /* DE.....DDEP....D */
- $"5500 0000 0000 0550 6600 0000 0000 0500" /* U......Pf....... */
- $"0660 0000 0000 0000 0660 0000 0000 0000" /* .`.......`...... */
- $"0066 0000 0000 0000 0066 0000 0000 0000" /* .f.......f...... */
- $"0000 0000 0000 0000 0000 0000 0006 0000" /* ................ */
- $"FFFF FFFF FFFF 0001 0000 DB00 0000 0002" /* ................ */
- $"FFFF DB00 0000 0003 FFFF 4F00 0000 0004" /* ..........O..... */
- $"DB00 0000 0000 0005 9200 0000 B000 0006" /* ........í...∞... */
- $"0000 0000 FFFF" /* ...... */
- };
-
-
- include "Defaults.rsrc" 'STR#' (kDefaultCredits); // Grab the default credits
-
- // Get the default MacApp® application icon and necessary bundling rsrcs
- include "Defaults.rsrc" 'MApp' (0);
- include "Defaults.rsrc" 'FREF' (128);
- include "Defaults.rsrc" 'BNDL' (128);
- include "Defaults.rsrc" 'ICN#' (128);
-
- // Get the default Version resources
- include "Defaults.rsrc" 'vers' (1); // Application or file specific
- include "Defaults.rsrc" 'vers' (2); // Overall package
-